Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Check for non-public modifiers in constructors (#4511) #4619

Merged
merged 1 commit into from
Apr 1, 2019
Merged

Check for non-public modifiers in constructors (#4511) #4619

merged 1 commit into from
Apr 1, 2019

Conversation

ericbf
Copy link
Contributor

@ericbf ericbf commented Mar 29, 2019

This commit checks the modifiers of each constructor declaration. If it has any modifier that isn't public, then it is actually necessary and shouldn't be flagged.

PR checklist

Overview of change:

Iterate through the modifiers of each constructor declaration. If it has any modifiers that isn't public, keep it.

CHANGELOG.md entry:

[bugfix] unnecessary-constructor: don't flag constructors that are actually necessary

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic LGTM, thanks for sending this @ericbf!

Just one slight improvement in the implementation details. We can apply the fix automatically if you don't see this soon, just figured you might want to get the satisfaction. 😄

src/rules/unnecessaryConstructorRule.ts Outdated Show resolved Hide resolved
This commit checks the modifiers of each constructor declaration. If it has any modifier that isn't `public`, then it's actually necessary and shouldn't be flagged by unnecessary-constructor rule.
@ericbf
Copy link
Contributor Author

ericbf commented Apr 1, 2019

Didn't know if GitHub would automatically identify the change as made 😆. Updated now.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, thanks @ericbf! ✨

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[unnecessary-constructor] Incorrectly flagging accessibility-restricting constructors
2 participants